#ifndef __TSS_H_f57dbdf4eeb6488ba57a26c18f8494d3__
#define __TSS_H_f57dbdf4eeb6488ba57a26c18f8494d3__

#include "stdint.h"
#include "hal.h"

#define MAX_TSS_NUM 100
#define TSS_STEP 2
#define FIRST_TSS_ENTRY 4

typedef struct _tss_struct
{
	uint32_t prevTss;
	uint32_t esp0;
	uint32_t ss0;
	uint32_t esp1;
	uint32_t ss1;
	uint32_t esp2;
	uint32_t ss2;
	uint32_t pageBase;
	uint32_t eip;
	uint32_t eflags;
	uint32_t eax;
	uint32_t ecx;
	uint32_t edx;
	uint32_t ebx;
	uint32_t ebp;
	uint32_t esi;
	uint32_t edi;
	uint32_t es;
	uint32_t cs;
	uint32_t ss;
	uint32_t ds;
	uint32_t fs;
	uint32_t gs;
	uint32_t ldtSelector;
	uint16_t trap;
	uint16_t iomap;
}tss_struct;

void i86_tss_install(uint32_t index,uint32_t kernelSS,uint32_t kernelESP,uint32_t pageBase);
void i86_tss_flush(uint32_t index);
tss_struct *i86_tss_get_tss_struct(uint32_t index);

#endif